package com.thor.palmmall.rest.hdmall.sales.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.hdmall.sales.HDMSalesInputCondition;
import com.thor.palmmall.rest.hdmall.sales.MSalesInputCondition;
/**
 * @author:liyang
 * @time:2017年7月25日 下午4:14:02
 * @since:1.0
 */
public class HDMSalesInputConditionConverter
    implements Converter<MSalesInputCondition, HDMSalesInputCondition> {
  public static HDMSalesInputConditionConverter getInstance() {
    if (instance == null)
      instance = new HDMSalesInputConditionConverter();
    return instance;
  }

  private static HDMSalesInputConditionConverter instance;

  private HDMSalesInputConditionConverter() {
  }

  @Override
  public HDMSalesInputCondition convert(MSalesInputCondition source) {

    if (source == null) {
      return null;
    }

    HDMSalesInputCondition dest = new HDMSalesInputCondition();

    dest.setContract(source.getContract());
    dest.setDateRange(HDMDateRangeConverter.getInstance().convert(source.getDateRange()));

    return dest;
  }

}